﻿@model App.Models.Sys.SysModuleOperateModel
@using App.Common;
@using App.Models.Sys;
@using App.Admin;
@{
    ViewBag.Title = "创建";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = (List<permModel>)ViewBag.Perm;
    if (perm == null)
    {
        perm = new List<permModel>();
    }
}

<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            if ($("form").valid()) {
                $.ajax({
                    url: "@Url.Action("CreateOpt")",
                    type: "Post",
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (data) {
                        if (data.type == 1) {
                            window.parent.frameReturnByMes(data.message);
                            window.parent.frameReturnByReloadOpt(true);
                            window.parent.frameReturnByClose()
                        }
                        else {
                            window.parent.frameReturnByMes(data.message);
                        }
                    }
                });
            }
            return false;
        });
        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose();
        });
    });
</script>
<div class="mvctool bgb">
@Html.ToolButton("btnSave", "icon-save", "保存", perm, "Save", true)
@Html.ToolButton("btnReturn", "icon-return", "返回",false)
</div>
@using (Html.BeginForm())
{
             @Html.HiddenFor(model => model.Id)
 <table class="fromEditTable setTextWidth300">
    <tbody>
        <tr>
            <td style="width:100px; text-align:right;">
                @Html.LabelFor(model => model.Name)：
            </td>
            <td style="width:310px">
                @Html.EditorFor(model => model.Name)
            </td>
            <td>@Html.ValidationMessageFor(model => model.Name)</td>
        </tr>
        <tr>
            <td style="width:100px; text-align:right;">
                @Html.LabelFor(model => model.KeyCode)：
            </td>
            <td style="width:310px">
                @Html.EditorFor(model => model.KeyCode)
            </td>
            <td>@Html.ValidationMessageFor(model => model.KeyCode)</td>
        </tr>
        <tr>
            <td style="width:100px; text-align:right;">
                @Html.LabelFor(model => model.ModuleId)：
            </td>
            <td style="width:310px">
                @Html.TextBoxFor(model => model.ModuleId, new { @readOnly = "readOnly" })
            </td>
            <td>@Html.ValidationMessageFor(model => model.ModuleId)</td>
        </tr>
        <tr>
            <td style="width:100px; text-align:right;">
                @Html.LabelFor(model => model.IsValid)：
            </td>
            <td style="width:310px">
                @Html.CheckBoxFor(model => model.IsValid,  new { @checked = true })
            </td>
            <td>@Html.ValidationMessageFor(model => model.IsValid)</td>
        </tr>
        <tr>
            <td style="width:100px; text-align:right;">
                @Html.LabelFor(model => model.Sort)：
            </td>
            <td style="width:310px">
                @Html.EditorFor(model => model.Sort)
            </td>
            <td>@Html.ValidationMessageFor(model => model.Sort)</td>
        </tr>
    </tbody>
</table>
}